package com.hs.core.dao;

import java.util.List;

import com.hs.core.db.DBOperator;
import com.hs.core.db.DatabaseConnection;
import com.hs.core.model.BlobObj;
import com.hs.core.model.TextObj;

public abstract class AbstractHsDao {
	
	private DBOperator  dbinstance = null;
	
	protected AbstractHsDao(){
		try {
			dbinstance = DatabaseConnection.getDBOperator();
		} catch (Exception e) { 
			e.printStackTrace();
		}
	}
	/**
	 * 功能说明:保存数据
	 * @param sql
	 * @param data
	 * @author shl
	 * @return
	 */
	public int saveData(String sql,Object[] params){
		return this.dbinstance.update(sql, params);
	}
	/**
	 * 功能说明:查询数据
	 * @param sql
	 * @param data
	 * @return list
	 */
	public List selectData(String sql,Object[] params){
		return this.dbinstance.select(sql, params);
	}
	/**
	 * 功能说明:获得Blob数据
	 * @param sql
	 * @param params
	 * @return
	 */
	public BlobObj getBlob(String sql,Object[] params){
		return this.dbinstance.getBlob(sql, params);
	}
	/**
	 * 功能说明:获得Clob数据
	 * @param sql
	 * @param params
	 * @return
	 */
	public  TextObj getClob(String sql,Object[] params){
		return this.dbinstance.getClob(sql, params);
	}
	/**
	 * 功能说明:删除数据
	 * @param sql
	 * @param params
	 * @return
	 */
	public  int deleteData(String sql,Object[] params){
		return this.dbinstance.update(sql, params);
	}

}
